package com.mt.demo.service.impl;

import com.mt.demo.util.DateUtils;
import com.mt.demo.domain.MtVoteQuestion;
import com.mt.demo.mapper.MtVoteQuestionMapper;
import com.mt.demo.service.IMtVoteQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 投票问题Service业务层处理
 * 
 * @author gary
 * @date 2025-08-11
 */
@Service
public class MtVoteQuestionServiceImpl implements IMtVoteQuestionService 
{
    @Autowired
    private MtVoteQuestionMapper mtVoteQuestionMapper;

    /**
     * 查询投票问题
     * 
     * @param questionId 投票问题主键
     * @return 投票问题
     */
    @Override
    public MtVoteQuestion selectMtVoteQuestionByQuestionId(Long questionId)
    {
        return mtVoteQuestionMapper.selectMtVoteQuestionByQuestionId(questionId);
    }

    /**
     * 查询投票问题列表
     * 
     * @param mtVoteQuestion 投票问题
     * @return 投票问题
     */
    @Override
    public List<MtVoteQuestion> selectMtVoteQuestionList(MtVoteQuestion mtVoteQuestion)
    {
        return mtVoteQuestionMapper.selectMtVoteQuestionList(mtVoteQuestion);
    }

    /**
     * 新增投票问题
     * 
     * @param mtVoteQuestion 投票问题
     * @return 结果
     */
    @Override
    public int insertMtVoteQuestion(MtVoteQuestion mtVoteQuestion)
    {
        mtVoteQuestion.setCreateTime(DateUtils.getNowDate());
        return mtVoteQuestionMapper.insertMtVoteQuestion(mtVoteQuestion);
    }

    /**
     * 修改投票问题
     * 
     * @param mtVoteQuestion 投票问题
     * @return 结果
     */
    @Override
    public int updateMtVoteQuestion(MtVoteQuestion mtVoteQuestion)
    {
        mtVoteQuestion.setUpdateTime(DateUtils.getNowDate());
        return mtVoteQuestionMapper.updateMtVoteQuestion(mtVoteQuestion);
    }

    /**
     * 批量删除投票问题
     * 
     * @param questionIds 需要删除的投票问题主键
     * @return 结果
     */
    @Override
    public int deleteMtVoteQuestionByQuestionIds(Long[] questionIds)
    {
        return mtVoteQuestionMapper.deleteMtVoteQuestionByQuestionIds(questionIds);
    }

    /**
     * 删除投票问题信息
     * 
     * @param questionId 投票问题主键
     * @return 结果
     */
    @Override
    public int deleteMtVoteQuestionByQuestionId(Long questionId)
    {
        return mtVoteQuestionMapper.deleteMtVoteQuestionByQuestionId(questionId);
    }
}
